
######################################
# target
######################################
TARGET = cvimg

CC = gcc

# C includes
C_INCLUDES =  -I.

# compile gcc flags
CFLAGS = $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall 

# Generate dependency information
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"

C_SOURCES = $(wildcard *.c)
OBJECTS = $(patsubst %.c, %.o, $(C_SOURCES))

# default action: build all
all: $(TARGET)

$(TARGET):$(OBJECTS)
	echo $(OBJECTS)
	$(CC) $^ $(LDFLAGS) -o $@

%.o:%.c
	$(CC) -c $(CFLAGS) $< -o $@

clean:
	-rm $(OBJECTS)
	-rm $(TARGET)
	-rm *.d
	
#######################################
# dependencies
#######################################
-include $(wildcard *.d)
